<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/common/tagPage.jsp" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>交货订单表</title>
    <meta name="keywords" content="中文"/>
    <meta name="description" content="下载"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

    <!-- basic styles -->
    <link href="${baseurl}statics/assets/css/bootstrap.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="${baseurl}statics/assets/css/font-awesome.min.css"/>

    <!--[if IE 7]>
    <link rel="stylesheet" href="${baseurl}statics/assets/css/font-awesome-ie7.min.css"/>
    <![endif]-->
    <!-- fonts -->

    <link rel="stylesheet" href="${baseurl}statics/assets/css/fonts.css"/>
    <link rel="stylesheet" href="${baseurl}statics/assets/css/translateelement.css"/>

    <!-- ace styles -->

    <link rel="stylesheet" href="${baseurl}statics/assets/css/ace.min.css"/>
    <link rel="stylesheet" href="${baseurl}statics/assets/css/ace-rtl.min.css"/>
    <link rel="stylesheet" href="${baseurl}statics/assets/css/ace-skins.min.css"/>

    <!--[if lte IE 8]>
    <link rel="stylesheet" href="${baseurl}statics/assets/css/ace-ie.min.css"/>
    <![endif]-->

    <!-- inline styles related to this page -->
    <!-- 公共的js -->
    <script src="${baseurl}statics/assets/js/common.js"></script>
    <!-- ace settings handler -->

    <script src="${baseurl}statics/assets/js/ace-extra.min.js"></script>

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

    <!--[if lt IE 9]>
    <script src="${baseurl}statics/assets/js/html5shiv.js"></script>
    <script src="${baseurl}statics/assets/js/respond.min.js"></script>
    <![endif]-->
</head>

<body>

<div class="breadcrumbs" id="breadcrumbs">
    <script type="text/javascript">
        try {
            ace.settings.check('breadcrumbs', 'fixed')
        } catch (e) {
        }
    </script>
    <ul class="breadcrumb">
        <li>
            <i class="icon-home home-icon"></i>
            <a href="#">订单管理</a>
        </li>

        <li>
            <a href="${baseurl}deliveryOrder/findDeliveryOrder?roleId=1&adminId=1">交货订单列表</a>
        </li>
        <li class="active">交货订单详情</li>
    </ul><!-- .breadcrumb -->
</div>

<div class="page-content">
    <div class="row">
        <div class="col-xs-12">
            <div class="row">
                <div class="col-xs-12">
                    <h3 class="header smaller lighter blue">交货订单数据列表</h3>
                    <div class="table-header">
                        交货订单数据列表信息
                    </div>
                    <div class="table-responsive">

                        <div style="width: 20%">
                            <form class="form-search" action="${baseurl}deliveryOrder/findDeliveryOrder?roleId=${sysUserManage.roleId}&adminId=${sysUserManage.id}"
                                  method="post">
                                <div class="row" style="margin-top: 20px;float: left;">
                                    <div class="col-xs-12 col-sm-8">
                                        <div class="input-group">
                                            <input type="text" class="form-control search-query" name="keywords"
                                                   value="${keywords}"
                                                   placeholder="请输入交货订单号"/>
                                            <span class="input-group-btn">
                                                <button type="submit" class="btn btn-purple btn-sm">
                                                    搜索
                                                    <i class="icon-search icon-on-right bigger-110"></i>
                                                </button>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <!-- 时间筛选 -->
                        <%--<div style="float: left;margin-top: 20px;">
                            <div id="inPermission">
                                <a class="btn btn-purple btn-sm" href="${baseurl}userDict/addUserDict"
                                   style="margin-left: 20px;">添加</a>
                            </div>
                        </div>--%>
                        <table id="sample-table-2" class="table table-striped table-bordered table-hover"
                               style="margin-top: 20px; text-align: center; vertical-align: middle">
                            <thead>
                            <tr>
                                <th class="center">
                                    <label>
                                        <input type="checkbox" class="ace"/>
                                        <span class="lbl"></span>
                                    </label>
                                </th>
                                <th style="text-align: center;vertical-align: middle">排产订单id</th>
                                <th style="text-align: center;vertical-align: middle">交货订单号</th>
                                <th style="text-align: center;vertical-align: middle">申请时间</th>
                                <th style="text-align: center;vertical-align: middle">实际交期</th>
                                <th style="text-align: center;vertical-align: middle">排产信息</th>
                                <th style="text-align: center">收货信息</th>
                                <th style="text-align: center;vertical-align: middle">业务状态</th>
                                <th style="text-align: center;vertical-align: middle">
                                    业务操作
                                </th>
                            </tr>
                            </thead>

                            <tbody>
                            <c:forEach items="${page.records}" var="deliveryOrder">
                                <tr>
                                    <td class="center" style="vertical-align: middle">
                                        <label>
                                            <input type="checkbox" class="ace"/>
                                            <span class="lbl"></span>
                                        </label>
                                    </td>
                                    <td style="vertical-align: middle">${deliveryOrder.productionId}</td>
                                    <td style="vertical-align: middle">${deliveryOrder.deliveryNo}</td>
                                    <td style="vertical-align: middle"><fmt:formatDate
                                            value="${deliveryOrder.applyTime}"
                                            pattern="YYYY年M月d日 HH:mm:ss"></fmt:formatDate>
                                    </td>
                                    <td style="vertical-align: middle"><span style="color: red;font-weight:bold;">
                                            <fmt:formatDate value="${deliveryOrder.realityTime}"
                                                            pattern="YYYY/M/d HH:mm:ss"></fmt:formatDate></span>
                                    </td>
                                    <td style="vertical-align: middle">
                                        <table class="table table-striped table-bordered table-hover"
                                               style="margin-top: 20px;vertical-align:center;">
                                            <tr style="vertical-align:center;font-weight: bolder">
                                                <td style="vertical-align:center;">
                                                    <c:if test="${deliveryOrder.sizeType == 1}">标准码</c:if>
                                                    <c:if test="${deliveryOrder.sizeType == 2}">欧码</c:if>
                                                    <c:if test="${deliveryOrder.sizeType == 3}">美码</c:if>
                                                </td>
                                                <c:forEach items="${deliveryOrder.deliveryOrderList}" var="sizeInfo">
                                                    <td style="vertical-align:center;">${sizeInfo.size}</td>
                                                </c:forEach>
                                            </tr>
                                            <tr style="vertical-align:center">
                                                <td style="vertical-align:center;">数量(双)</td>
                                                <c:forEach items="${deliveryOrder.deliveryOrderList}" var="numberInfo">
                                                    <td style="vertical-align:center;">${numberInfo.number}</td>
                                                </c:forEach>
                                            </tr>
                                        </table>
                                    </td>
                                    <td  style="vertical-align: middle;line-height: 27px">
                                        <c:if test="${deliveryOrder.province==deliveryOrder.city}">
                                            ${deliveryOrder.userName}(${deliveryOrder.userPhone})<br/>
                                            ${deliveryOrder.province}${deliveryOrder.counties}${deliveryOrder.warehouseAddress}
                                        </c:if>
                                        <c:if test="${deliveryOrder.province!=deliveryOrder.city}">
                                            ${deliveryOrder.userName}(${deliveryOrder.userPhone})<br/>
                                            ${deliveryOrder.province}${deliveryOrder.city}${deliveryOrder.counties}${deliveryOrder.warehouseAddress}
                                        </c:if>
                                    </td>
                                    <td style="vertical-align: middle">
                                        <c:if test="${deliveryOrder.status == 1}">
                                            待确认
                                        </c:if>
                                        <c:if test="${deliveryOrder.status == 2}">
                                            待出库
                                        </c:if>
                                        <c:if test="${deliveryOrder.status == 3}">
                                            运输中
                                        </c:if>
                                        <c:if test="${deliveryOrder.status == 4}">
                                            完成交货
                                        </c:if>
                                    </td>
                                    <td style="vertical-align: middle">
                                        <shiro:hasPermission name="deliveryOrder:check">
                                            <c:if test="${deliveryOrder.status eq 1}">
                                                <a href="javascript:onclick = changeStatus('${deliveryOrder.deliveryOrderId}','${deliveryOrder.status}');">已确认</a>
                                            </c:if>
                                            <c:if test="${deliveryOrder.status eq 2}">
                                                <a href="javascript:onclick = changeStatus('${deliveryOrder.deliveryOrderId}','${deliveryOrder.status}');">已出库</a>
                                            </c:if>
                                            <c:if test="${deliveryOrder.status eq 3}">
                                                <a href="javascript:onclick = logisticsTo(${deliveryOrder.deliveryOrderId})">物流/交货</a>
                                            </c:if>
                                            <c:if test="${deliveryOrder.status eq 4}">
                                                OK
                                            </c:if>
                                        </shiro:hasPermission>
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                        <jsp:include page="/WEB-INF/jsp/common/pageHelper.jsp"/>
                    </div>
                </div>
            </div>
        </div><!-- /.col -->
    </div><!-- /.row -->
</div><!-- /.page-content -->

<script type="text/javascript">
    window.jQuery || document.write("<script src='${baseurl}statics/assets/js/jquery-2.0.3.min.js'>" + "<" + "/script>");
</script>

<!-- <![endif]-->

<!--[if IE]>
<script type="text/javascript">
    window.jQuery || document.write("<script src='${baseurl}statics/assets/js/jquery-1.10.2.min.js'>" + "<" + "/script>");
</script>
<![endif]-->

<script type="text/javascript">
    if ("ontouchend" in document) document.write("<script src='${baseurl}statics/assets/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
</script>
<script src="${baseurl}statics/assets/js/bootstrap.min.js"></script>
<script src="${baseurl}statics/assets/js/typeahead-bs2.min.js"></script>


<script src="${baseurl}statics/assets/js/ace-elements.min.js"></script>
<script src="${baseurl}statics/assets/js/ace.min.js"></script>

<!-- inline scripts related to this page -->

<script type="text/javascript">
    //    删除用户数据
    function del(deliveryOrderId) {
        var k = window.confirm("确定是否要删除！");
        if (k) {
            $.ajax({
                url: "${baseurl}deliveryOrder/deleteDeliveryOrder",
                data: {"deliveryOrderId": deliveryOrderId},
                type: "post",
                success: function (json) {
                    console.log(json.code);
                    if (json.code == 0) {
                        alert(json.message);
                        location.reload();
                    } else {
                        alert(json.message);
                    }
                },
                error: function (json) {
                    alert("error");
                }
            });
        }
    }
    function logisticsTo(id) {
        window.location.href = "/deliveryOrder/logisticsFind?deliveryId=" + id;
    }
    /*
     * 该变试做状态
     * id 试做id
     * status 状态  此状态需后台进行操作判断
     * */
    function changeStatus(id, status) {

        var k;
        if (status == 1) {
            k = window.confirm("是否确认！");
        }
        if (status == 2) {
            k = window.confirm("是否确认出库！");
        }
        if (k) {
            $.ajax({
                url: "${baseurl}deliveryOrder/changeStatus",
                data: {"deliveryOrderId": id, "status": status},
                type: "post",
                dataType: "json",
                success: function (json) {
                    if (json.code == 0) {
                        alert(json.message);
                        location.reload();
                    } else {
                        alert(json.message);
                    }
                },
                error: function (json) {
                    alert("error");
                }
            });
        }

    }
</script>
</body>
</html>

